﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace BLL
{
    public class PhieunhapBLL:DAL.PhieunhapDAL
    {
        public string Phieunhap_Taoma(string SubMa)
        {
            var tb = base.Phieunhap_Select_Taoma(SubMa);
            var m = "0";

            if (tb != null && tb.Rows.Count > 0)
            {
                m = tb.Rows[0]["Ma"] + "";
                m = m.Substring(11);
            }

            var x = Convert.ToInt32(m);
            x++;

            m = String.Format("PN{0:0#}{1:0#}{2:000#}-{3:000#}", DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year, x);
            return m;
        }
    }
}
